package com.alibaba.aone.casestudy.common.utils;



import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;






/**
 * 类TimeUtil.java的实现描述：TODO 类实现描述 
 * @author yongchun.chengyc 2011-5-8 下午07:51:54
 */
public class TimeUtil {
	public static String TimeToString(Date date){
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm");
		String timeToString = format.format(date);
		return timeToString;
	}
	
	public static Date stringToTime(String string) throws ParseException{
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm");
		Date stringToTime = format.parse(string);
		return stringToTime;
	}

	public static void main(String[] args) throws ParseException {
		
		
		System.out.println(TimeUtil.TimeToString(new Date()));
		System.out.println(TimeUtil.stringToTime(TimeUtil.TimeToString(new Date())));
	}
}
